package cn.lifei.org.controller;

import cn.lifei.basic.annotation.LifeiPermission;
import cn.lifei.basic.util.AjaxResult;
import cn.lifei.org.domain.Employee;
import cn.lifei.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/employee")
@LifeiPermission(name = "员工管理")
public class EmployeeControlelr {
    @Autowired
    public IEmployeeService employeeService;

    @GetMapping
    @LifeiPermission(name = "查询所有员工")
    public AjaxResult getAll(){
        try {
            List<Employee> list =  employeeService.queryAll();
            return AjaxResult.success(list);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error(e.getMessage());
        }
    }
}
